import { defineStore } from 'pinia';

interface ObjectList {
    [key: string]: string[];
}

export const usePermissStore = defineStore('permiss', {
    state: () => {
        const defaultList: ObjectList = {
            admin: [
                '0',
                '1',
                '11',
                '12',
                '13',
            
  
                '42',
                '43',
                '60',
                '61'
            ],
            teacher: ['0','42','43','60','61'],
            student: ['0','3','32','34','33','60','61'],
        };
        const role=localStorage.getItem('vuems_role');
        return {
            key: (role?defaultList[role]:[]) as string[],
            defaultList,
        };
    },
    actions: {
        update() {
            const role=localStorage.getItem('vuems_role');
            this.key = (role?this.defaultList[role]:[]) as string[];
        },
    },
});
